(()=>{"use strict";let e=e=>window.requestIdleCallback?window.requestIdleCallback(e,{timeout:200}):setTimeout(e,50),t="mybAuthUser_fastPostAuthLoad";window.bcl=window.bcl||{},["c","u","s"].forEach(e=>bcl[e]=bcl[e]||{}),bcl.load=!!Object.prototype.hasOwnProperty.call(bcl,"load")&&bcl.load,bcl.preInit=bcl.preInit||[],bcl.u.breakMobile=1023,bcl.u.breakTablet=605,bcl.u.breakMobilePlus=1024,bcl.u.mobile={Android:function(){return navigator.userAgent.match(/Android/i)},BlackBerry:function(){return navigator.userAgent.match(/BlackBerry/i)},iOS:function(){return navigator.userAgent.match(/iPhone|iPad|iPod/i)},Opera:function(){return navigator.userAgent.match(/Opera Mini/i)},Windows:function(){return navigator.userAgent.match(/IEMobile/i)||navigator.userAgent.match(/WPDesktop/i)},webView:function(){return/(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/i.test(navigator.userAgent)},isMobile:function(){return window.matchMedia?window.matchMedia(`(max-width: ${bcl.u.breakMobile}px)`).matches:window.innerWidth<=bcl.u.breakMobile},isTablet:function(){return window.matchMedia?window.matchMedia(`(min-width: ${bcl.u.breakTablet}px) and (max-width: ${bcl.u.breakMobile}px)`).matches:window.innerWidth=bcl.u.breakTablet}};let n=e=>{"function"!=typeof window.requestAnimationFrame?window.setTimeout(e,32):window.requestAnimationFrame(()=>window.requestAnimationFrame(e))},o={avif:!1,webp:!1},i="www.barcelo.com"===window.location.hostname?3800:2e3,r="__barceloImageOptimizerInitialized",a="square",s="land",l="port",c="stripe",d="optm",u={[a]:{width:500,height:500},[s]:{width:500,height:250},[l]:{width:500,height:1e3},[c]:{width:500,height:125}},m=new WeakMap,h=!1,p=!1,g=0,f=new WeakMap,b=new WeakMap,A=new WeakMap,w=null,y=null,v=e=>requestAnimationFrame(()=>requestAnimationFrame(e)),L=function(e){return e.closest(".dynamicLoading")},S=function(e,t,n){if(t.classList.contains("visibleComponent"))return void n();if(m.has(e))return;let o=new MutationObserver(()=>{t.classList.contains("visibleComponent")&&(o.disconnect(),m.delete(e),n())});o.observe(t,{attributes:!0,attributeFilter:["class"]}),m.set(e,o)},E=function(e){let t=e.closest(".brh-modal, .tingle-modal, .c-modal");if(!t||!(t.offsetWidth||t.offsetHeight||t.getClientRects().length))return!1;let n=e.querySelectorAll(".component-loader");for(let t=0;t{let n=e,o=t?n.clientWidth:n.clientHeight;for(;0===o&&n.parentNode&&n.parentNode!==document.body;)n=n.parentNode,o=t?n.clientWidth:n.clientHeight;return{dimension:o,container:n}},P=(e,t=!0)=>{let{dimension:n}=k(e,t);return((e,t=!0)=>{let n=t?window.innerWidth:window.innerHeight,o=e;o>n&&(o=n);let r=(()=>{if(null!==y)return y;let e=window.devicePixelRatio||1,t=navigator.connection;if(t){let{effectiveType:n,saveData:o,downlink:i}=t;(o||i<2||["slow-2g","2g","3g"].includes(n))&&(e=1)}return y=e,requestAnimationFrame(()=>{y=null}),e})(),a=100*Math.ceil(o*(window.bcl?.u?.mobile?.isMobile()&&r>=1.75?r/2:r)/100),s=t?i:2e3;return 0===a?100:Math.min(a,s)})(n,t)},C=e=>{let{dimension:t,container:n}=k(e,!0),{dimension:o,container:i}=k(e,!1);if(n===document.body||i===document.body||0===t||0===o)return!0;let r=e.parentElement;if(r){let e=r.clientWidth;if(t===window.innerWidth&&e>0&&e<.9*t)return!0}return!1},q=e=>{let t=e.closest("[data-rendition-breakpoints]");if(!t)return d;try{let e=JSON.parse(t.getAttribute("data-rendition-breakpoints"));return window.bcl?.u?.mobile?.isMobile()?Object.keys(e)[0]:Object.keys(e)[1]||Object.keys(e)[0]}catch(e){return console.warn("Invalid data-rendition-breakpoints JSON",e),d}},T=e=>{if("true"===e.dataset.layoutStabilized)return;let t=u[q(e)];t&&(e.dataset.layoutStabilized="true",e.setAttribute("width",t.width),e.setAttribute("height",t.height))},x=e=>{let t=e.exec(window.navigator.userAgent||"");return t?Number.parseInt(t[1],10):0},M=()=>{if(!navigator.connection)return null;if(navigator.connection.saveData)return"30";switch(navigator.connection.effectiveType){case"slow-2g":case"2g":return"30";case"3g":return"35";case"4g":if(void 0!==navigator.connection.downlink&&navigator.connection.downlink<2)return"40";return null;default:return null}},R=async function(e,t,n){window.bcl.s.performance.processedImages=(window.bcl.s.performance.processedImages||0)+1;let r=window.bcl.s.performance.processedImages,d=e.parentElement?.dataset?.cmpSrc;if(!d||!d.includes("/is/image/"))return void console.error("Error loading DM Image. URL invalid: "+d);let u=new URL(d.startsWith("//")?`https:${d}`:d,window.location.origin);"http:"===u.protocol&&(u.protocol="https:"),e.classList.add(`loadPosition-${r}`);let m=!!e.closest(".c-hotel-room-list__header"),h=q(e),p=null,g=e.parentElement?.dataset?.asset||"";if(/\/(logo|icon)/.test(g.toLowerCase())){if(!u.searchParams.has("qlt")){let e=M();u.searchParams.set("qlt",e||"50")}}else{switch(h){case a:m||(n=t),p=":Square";break;case l:m||(n=2*t),p=":Portrait";break;case"vert":p=":Vertical";break;case s:m||(n=t/2),p=":Landscape";break;case c:m||(n=t/4),p=":Stripe"}if(t&&(t=Math.min(t,i)),n&&(n=Math.min(n,2e3)),p&&(u.pathname+=p),!u.searchParams.has("wid")&&t&&u.searchParams.set("wid",t),!u.searchParams.has("hei")&&n&&u.searchParams.set("hei",n),(u.searchParams.has("wid")||u.searchParams.has("hei"))&&!u.searchParams.has("fit")&&u.searchParams.set("fit","crop,1"),!u.searchParams.has("qlt")){let e=M(),t=window.bcl?.u?.mobile?.isMobile()?"50":o.avif?"60":"75";u.searchParams.set("qlt",e||t)}}let f=o.avif?"avif-alpha":o.webp?"webp-alpha":u.toString().includes(".png")?"png8-alpha":"pjpeg";u.searchParams.set("fmt",f),u.searchParams.set("cache","update,on,on"),u.searchParams.set("defaultImage","default-dm"),u.searchParams.has("dpr")||u.searchParams.set("dpr","off");let b=window.bcl?.u?.mobile?.isMobile()?"mobile":"desktop",A=e.closest(`[data-${b}-alignment]`)?.dataset[`${b}Alignment`];if(A){let[e,t]=A.split("-").map(e=>"left"===e?-1:+("right"===e));u.searchParams.set("align",[e,t].join(","))}e.closest(".bwd-commitment")&&u.searchParams.set("dpr","on,2"),(e=>{let t=Array.from(e.searchParams.entries());if(0===t.length)return;let[n,o]=t[0];n&&n.startsWith("$")&&n.endsWith("$")&&(e.searchParams.delete(n),e.searchParams.set(n,o))})(u);let w=decodeURIComponent(u.toString());document.querySelectorAll(`img.loadPosition-${r}`).forEach(e=>{e.src=w})},I=e=>{let t=b.get(e);if(!t)return;let{container:n,timeoutId:o}=t;clearTimeout(o),b.delete(e);let i=f.get(n);i&&(i.delete(e),0===i.size&&(f.delete(n),w&&w.unobserve(n)))},O=e=>{if(!("ResizeObserver"in window))return;I(e);let t=e.parentElement||e;if(!t||t===document.body)return;w||(w=new ResizeObserver(e=>{for(let t of e){let e=t.target,n=f.get(e);n&&n.forEach(t=>{clearTimeout(A.get(t));let n=setTimeout(()=>{t.isConnected?0!==e.clientWidth&&0!==e.clientHeight&&("true"!==t.dataset.optimized&&B(t),"true"===t.dataset.optimized&&I(t)):I(t)},80);A.set(t,n)})}}));let n=f.get(t);n||(n=new Set,f.set(t,n),w.observe(t)),n.add(e);let o=setTimeout(()=>{e.isConnected&&"true"!==e.dataset.optimized&&B(e,null,null,!0),I(e)},4e3);b.set(e,{container:t,timeoutId:o})},B=(e,t=null,n=null,o=!1)=>{if("true"===e.dataset.optimized)return;if(!o&&C(e))return void O(e);T(e),e.dataset.optimized="true";let i=t??P(e,!0),r=n??P(e,!1);e.parentElement?.dataset?.isDm==="true"?R(e,i,r):((e,t)=>{let n=e.parentElement?.dataset?.cmpSrc;if(!n)return;let o=q(e);e.src=n.includes("bhgimg")?n.replace("bhgimg",`bhgimg.${o}${t}`):n})(e,i)},$=(e,t=!1)=>{e.loading="eager",t&&e.closest("main")&&g<4&&(e.fetchPriority="high",e.setAttribute("fetchpriority","high"),g+=1)},W=()=>({height:window.innerHeight||document.documentElement.clientHeight||0,width:window.innerWidth||document.documentElement.clientWidth||0}),z=(e=document)=>{window.requestAnimationFrame(()=>{let t=e.querySelectorAll?.("img[data-barcelo-image='true']:not([data-optimized='true'])");if(!t||!t.length)return;let n=W(),o=[];t.forEach(e=>{if(e.isConnected&&((e,t=W())=>{let n=e.getBoundingClientRect();return n.width>0&&n.height>0&&n.bottom>=0&&n.right>=0&&n.top<=t.height&&n.left<=t.width})(e,n)){if(C(e))return void o.push({img:e,suspicious:!0});o.push({img:e,suspicious:!1,width:P(e,!0),height:P(e,!1)})}}),o.forEach(({img:e,suspicious:t,width:n,height:o})=>{($(e),t)?O(e):B(e,n,o,!0)})})},F=(e,t=W())=>{if(!e?.getBoundingClientRect)return!1;let n=e.getBoundingClientRect();return n.bottom>=-200&&n.top<=t.height+200&&n.right>=0&&n.left<=t.width},N=()=>{if(h)return;h=!0;let e=document.querySelectorAll("img[data-barcelo-image='true']:not([data-optimized='true'])"),t=new IntersectionObserver((e,t)=>{e.forEach(e=>{let n=e.target;if(!e.isIntersecting||!n.isConnected||"true"===n.dataset.optimized)return;let o=L(n);o&&!o.classList.contains("visibleComponent")&&E(o),$(n),B(n),t.unobserve(n)})},{rootMargin:"10%"});e.forEach(e=>{T(e),e.loading="lazy",t.observe(e)}),new MutationObserver(e=>{let n=[];if(e.forEach(e=>{e.addedNodes.forEach(e=>{e.querySelectorAll&&e.querySelectorAll("img[data-barcelo-image='true']:not([data-optimized='true'])").forEach(e=>n.push(e))})}),0===n.length)return;let o=()=>{let e=W();n.forEach(n=>{if(T(n),F(n,e)){let e=L(n);if(e&&!e.classList.contains("visibleComponent")){if(E(e)){$(n,!0),B(n);return}S(n,e,()=>{$(n,!0),B(n)});return}$(n,!0),B(n)}else n.loading="lazy",t.observe(n)})};"requestIdleCallback"in window?requestIdleCallback(o,{timeout:500}):setTimeout(o,50)}).observe(document,{childList:!0,subtree:!0})},H=!1,U=async()=>{let[e,t]=await Promise.all([new Promise(e=>{let t=new Image;t.addEventListener("error",()=>e(!1)),t.addEventListener("load",()=>e(1===t.width)),t.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUEAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABYAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgSAAAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB5tZGF0EgAKBzgADlAgIGkyCR/wAABAAACvcA=="}).catch(()=>!1),new Promise(e=>{let t=new Image;t.addEventListener("error",()=>e(!1)),t.addEventListener("load",()=>e(1===t.width)),t.src="data:image/webp;base64,UklGRiQAAABXRUJQVlA4IBgAAAAwAQCdASoBAAEAAwA0JaQAA3AA/vuUAAA="}).catch(()=>!1)]);o.avif=e,o.webp=t},j=async()=>{let e,t,i,r,a,s,l,c;window.bcl=window.bcl||{},window.bcl.s=window.bcl.s||{},window.bcl.s.performance=window.bcl.s.performance||{},e=window.navigator.userAgent||"",t=!/iP(?:hone|ad|od)/.test(e)&&x(/\b(?:Chrome|Chromium|Edg|OPR)\/(\d+)/),i=x(/\bFirefox\/(\d+)/),r=x(/\bVersion\/(\d+).+Safari\//),o.avif=t>=85||i>=93||r>=16,o.webp=o.avif||t>=32||i>=65||r>=14,a=Array.from(document.querySelectorAll("img[data-barcelo-image='true']:not([data-optimized='true'])")),l=(s=!!document.querySelector(".heroslider .video-poster-overlay"))?[]:a.slice(0,6),c=s?a:a.slice(6),l.forEach(T),v(()=>{let e=W();l.forEach(t=>{if("true"!==t.dataset.optimized)if(F(t,e)){let e=L(t);if(e&&!e.classList.contains("visibleComponent"))return void S(t,e,()=>{$(t,!0),B(t)});$(t,!0),B(t)}else t.loading="lazy"})}),0!==c.length&&n(()=>{c.forEach(e=>{"true"!==e.dataset.optimized&&T(e)}),v(()=>{let e=W();c.filter(e=>"true"!==e.dataset.optimized).forEach(t=>{if(F(t,e)){let e=L(t);if(e&&!e.classList.contains("visibleComponent"))return void S(t,e,()=>{$(t,!0),B(t)});$(t,!0),B(t)}else t.loading="lazy"})})});let d=()=>{let e;p||(p=!0,document.addEventListener("stylesLoaded",()=>{H||(H=!0,window.requestAnimationFrame(()=>{H=!1,z(document)}))}),document.addEventListener("modal-open",e=>{z(e.detail||document)}),document.addEventListener("brh:modal:open",()=>{z(document.querySelector(".brh-modal")||document)})),e=()=>{document.removeEventListener("scroll",e,!0),document.removeEventListener("touchstart",e,!0),document.removeEventListener("pointerdown",e,!0),document.removeEventListener("keydown",e,!0),n(N)},document.addEventListener("scroll",e,{once:!0,passive:!0,capture:!0}),document.addEventListener("touchstart",e,{once:!0,passive:!0,capture:!0}),document.addEventListener("pointerdown",e,{once:!0,passive:!0,capture:!0}),document.addEventListener("keydown",e,{once:!0,capture:!0}),window.addEventListener("load",()=>{"requestIdleCallback"in window?requestIdleCallback(()=>e(),{timeout:2e3}):setTimeout(e,200)},{once:!0})};"loading"!==document.readyState?d():document.addEventListener("DOMContentLoaded",d,{once:!0}),U()};window[r]||(window[r]=!0,j());let D=null,_=async()=>(D||(D=fetch("/libs/granite/csrf/token.json",{credentials:"same-origin"}).then(e=>e.ok?e.json():null).then(e=>e?.token||"").catch(e=>(console.error("Fetch CSRF token error:",e),D=null,""))),D),G=async(e,t,n)=>{if(n||!(e=>{try{return new URL(e,window.location.origin).origin===window.location.origin}catch{return!1}})(t))return;let o=await _();o&&(e["CSRF-Token"]=o)};bcl.ajax={async getRequest(e,t,n,o,i,r){try{let a=await fetch(t,{method:"GET",headers:i?{"X-Requested-With":"XMLHttpRequest"}:{},credentials:"same-origin"}),s=await a.text(),l={status:a.status,statusText:a.statusText,responseURL:a.url,readyState:4,responseText:s,response:s,getResponseHeader:e=>a.headers.get(e)};a.ok?(e&&(e.innerHTML=s),n&&("string"==typeof n?bcl.u.executeFunctionByName(n,window,l,e,o):"function"==typeof n&&n(l,o)),e&&document.dispatchEvent(new CustomEvent("ajax-executed",{detail:e}))):(bcl.u.removeBhgLoading(),r&&r(o,l))}catch(e){console.error("Fetch GET error in url:",t),console.error("GET error details:",e),bcl.u.removeBhgLoading(),r&&r(o,e)}},async postRequest(e){let{data:t={},url:n,contentType:o,errorCallback:i,auth:r}=e;if(!n)return;let a="json"===o,s={"Content-Type":a?"application/json":"application/x-www-form-urlencoded"};r&&(s.Authorization=r),await G(s,n,r);let l=a?JSON.stringify(t):bcl.u.serializeObject(t);try{let t=await fetch(n,{method:"POST",headers:s,body:l,credentials:"same-origin"}),o=await t.text(),i={status:t.status,statusText:t.statusText,responseURL:t.url,readyState:4,responseText:o,response:o,getResponseHeader:e=>t.headers.get(e)};this.onLoad(e,i)}catch(t){console.error("Fetch POST error in url:",n),console.error("POST error details:",t),i&&i(e.itemCallback,t)}},async putRequest(e){let{data:t,url:n,contentType:o,errorCallback:i}=e;if(!n)return;let r=o.includes("Bearer"),a=r?{"Content-Type":"application/json",Authorization:o}:{};await G(a,n,r);try{let o=await fetch(n,{method:"PUT",headers:a,body:r?JSON.stringify(t):t,credentials:"same-origin"}),i=await o.text(),s={status:o.status,statusText:o.statusText,responseURL:o.url,readyState:4,responseText:i,response:i,getResponseHeader:e=>o.headers.get(e)};this.onLoad(e,s)}catch(t){console.error("Fetch PUT error in url:",n),console.error("PUT error details:",t),i&&i(e.itemCallback)}},onLoad(e,t){let{callback:n,itemCallback:o,errorCallback:i}=e;t.status>=200&&t.status<400&&n&&("string"==typeof n?bcl.u.executeFunctionByName(n,window,t,o):"function"==typeof n&&n(t,o)),t.status>=400&&"function"==typeof i&&i(t,o)}};let K=window.bcl||{};K.contextHub={props:{nameSessionStorage:"contextHub.",nameProfile:"profile",nameFav:"favorites",pending:"pending",url:"/bin/barcelo/loadProfile.json",stores:{},ttl:6e5,storesPending:{},requestsPending:{},lasukmybCookie:"lasukmyb",lasukmybErrorCookie:"lasukmyb-error",loginError:["inactive-user","not-userid","not-useremail","api-error","generic-error"]},init:function(){let e=function(){let e=K.contextHub.get(K.contextHub.props.nameProfile);K.contextHub.makeRequest(e)};"loading"!==document.readyState?e():document.addEventListener("DOMContentLoaded",e)},makeRequest:function(e,t=0,n=5){e?this.executeAllPending(this.props.nameProfile):this.props.requestsPending[this.props.nameProfile]||(this.validLoginButton()||this.fixLoginButton(),this.props.requestsPending[this.props.nameProfile]=!0,K.ajax.postRequest({url:this.props.url,data:{},callback:e=>{this.props.requestsPending[this.props.nameProfile]=!1,K.contextHub.handleResponse(e,t,n)},errorCallback:(e,t)=>{this.props.requestsPending[this.props.nameProfile]=!1;let n=e?.status?e:t,o=e?.store?e:t;this.handleError(n,o)},itemCallback:{store:this.props.nameProfile}}))},handleError:function(e,t){let n=e?.status||e?.response?.status||e?.request?.status;401===n||403===n||console.error("AJAX error:",e),this.executeAllPending(t?.store||this.props.nameProfile)},handleResponse:function(e,t,n){e&&200===e.status&&e.response?this.getRequest(e,{store:this.props.nameProfile}):t+1{K.contextHub.makeRequest(null,t+1,n)},1e3):(console.error(`Failed to load profile after ${n} attempts.`),this.setAnonymousStore({store:this.props.nameProfile}))},clearLoginSession:function(){sessionStorage.removeItem(`${this.props.nameSessionStorage}${this.props.nameProfile}`),["login-token","bhg-user","bhg-ciam-user","ROCP_token","ROCP_idToken",this.props.lasukmybCookie,this.props.lasukmybErrorCookie].forEach(e=>{document.cookie=`${e}=; Max-Age=0; path=/`})},setAnonymousStore:function(e){let t=e?.store||this.props.nameProfile,n={ready:!0,expiry:Date.now()+this.props.ttl,user:{},props:{}};sessionStorage.setItem(`${this.props.nameSessionStorage}${t}`,JSON.stringify(n)),this.props.stores[t]=n,this.executeAllPending(t)},getRequest:function(e,t){if(!e.response)return;let n=JSON.parse(e.response),o=e.getResponseHeader("X-Akamai-Edgescape")||"";n?.federationId&&K.cookie.set(this.props.lasukmybCookie,"1",{path:"/"});let i=e.getResponseHeader("X-Bgh-Client-Ip")||"",r={ready:!0,expiry:Date.now()+this.props.ttl,user:n,props:this.parseResponse(o),clientIp:i},a=this.props.nameSessionStorage+(t&&t.store?t.store:this.props.nameProfile);sessionStorage.setItem(a,JSON.stringify(r)),this.props.stores[this.props.nameProfile]=r,this.executeAllPending(this.props.nameProfile)},validLoginButton:function(){let e=document.cookie.split(";").map(e=>e.trim()).find(e=>e.startsWith("mybLoginCleanv4="));if(!e)return!1;let t=new Date(decodeURIComponent(e.split("=")[1]));return!isNaN(t.getTime())&&t>new Date},fixLoginButton:function(){sessionStorage.removeItem(`${this.props.nameSessionStorage}${this.props.nameProfile}`),document.cookie=`${this.props.lasukmybErrorCookie}=; Max-Age=0; path=/`;let e=new Date;e.setMonth(e.getMonth()+6),document.cookie=`mybLoginCleanv4=true; expires=${e.toUTCString()}; path=/`},parseResponse:function(e){return e.split(",").reduce((e,t)=>{let[n,o]=t.split("=");return n&&o&&(e[n]=o),e},{})},callWhenReady:function(e,t){if("function"!=typeof e)return!1;let n=this.get(t);return n&&n.ready?e():this.addPending(t,e),!0},isEnabled:function(){return!0},get:function(e){let t=this.props.stores[e];if(!t){let n=sessionStorage.getItem(`${this.props.nameSessionStorage}${e}`);n&&(t=JSON.parse(n))}if(t){if(t.expirys.remove("dynamicLoading"),600)}return!0},a=function(e){if((e=null==e?2:e)>0)return void Z.requestAnimationFrame(()=>a(e-1));if(!r()){let e,t=[0,50,150,400,1e3],n=0,o=function(){!r()&&ned({classSelector:t,removeSelector:o,keepClasses:i,baseKey:l,emitEventOnLoad:n}),(s=er.get(l))||(s=[],er.set(l,s)),s.push(a),ee._cssPromises.has(l))return ee._cssPromises.get(l);let c=new Promise(function(t){var n;let o="function"==typeof ee.getLongCacheKey&&ee.getLongCacheKey(),i=o?e.replace(".css",`.lc-${o}-lc.min.css`):e;void 0!==Z.crossOriginURLS&&Z.crossOriginURLS.test(V.hostname)&&(n=i,i=en.test(n)?n:void 0!==Z.crossOriginURLS&&Z.crossOriginURLS.test(V.hostname)?n.startsWith("/")?`https://www.barcelo.com${n}`:`https://www.barcelo.com/${n}`:n);let a=!1,s=!1,c=function(){try{let e=er.get(l);if(e&&e.length){for(let t=0;t"function"==typeof window.matchMedia&&window.matchMedia("(max-width: 768px)").matches,loadStyles(){bcl.u.loadStyleSheet(bcl.s.loading.props.stylesheetHref,bcl.s.loading.props.dynamicClass)},init(e){let t=(e||document).body.dataset.loading;if(!t)return;let n=/localhost|author-barcelo-dev-65.adobecqms.net|author-barcelo-stage-65.adobecqms.net|author-barcelo-prod-65.adobecqms.net/.test(location.hostname)?`${t}?wcmmode=disabled`:t;bcl.s.loading.props.defaultLoading=n,bcl.s.loading.loadStyles(),!bcl.s.loading.isMobileViewport()&&bcl.s.loading.props.defaultLoading&&bcl.ajax.getRequest(null,bcl.s.loading.props.defaultLoading,bcl.s.loading.saveLoading,null,null,null,!1)},loadNewLoader(e){e?(bcl.s.loading.loadStyles(),bcl.ajax.getRequest(bcl.s.loading.props.loader,e)):console.error("No URL provided for loading new loader")},saveLoading(e){if(!e||!e.response)return void console.error("Invalid request or response in saveLoading");let t=document.createElement("div");t.innerHTML=e.response;let n=t.querySelector(bcl.s.loading.props.dynamicClass);n?bcl.s.loading.props.loader=n.cloneNode(!0):console.error(`Could not find '${bcl.s.loading.props.dynamicClass}' in the received HTML`)}},bcl.preInit.push(bcl.s.loading.init);let eu=window.requestIdleCallback||(e=>setTimeout(e,50));(()=>{let e=document.body?.classList.contains("isAuthor")||!!window.Granite?.author,n=(()=>{try{let e="true"===sessionStorage.getItem(t);return sessionStorage.removeItem(t),e}catch{return!1}})(),o=performance.now(),i=e?900:350*!n,r=e?3500:1e3,a=e?600:350,s=document.getElementById("global-loader");if(!s)return;let l=!1,c=null,d=null,u=null,m=null,h=null,p=0,g=(e=!0)=>{c&&(clearTimeout(c),c=null),d&&(clearTimeout(d),d=null),e&&u&&(clearTimeout(u),u=null),m&&(document.removeEventListener("visibilitychange",m),m=null)},f=()=>{l=!0,g(),s.remove()},b=()=>{l||(l=!0,g(!1),s.classList.add("is-hidden"),s.addEventListener("transitionend",e=>{e.target===s&&f()},{once:!0}),u=setTimeout(f,350))},A=e=>{if(!l&&!document.hidden){if(!(()=>{let e,{height:t,width:n}=(e=performance.now(),(!h||e-p>100)&&(h={height:window.innerHeight||document.documentElement.clientHeight,width:window.innerWidth||document.documentElement.clientWidth},p=e),h),o=document.querySelectorAll(".dynamicLoading .component-loader");for(let e=0;e0&&r.top0&&r.left=e)return void b();c=setTimeout(()=>{c=null,A(e)},100)}},w=()=>{l||(c&&(clearTimeout(c),c=null),document.hidden||(c=setTimeout(()=>{c=null,A(performance.now()+a)},Math.max(0,i-(performance.now()-o)))))},y=()=>{l||(d&&(clearTimeout(d),d=null),document.hidden||(d=setTimeout(()=>{d=null,document.hidden||b()},Math.max(0,r-(performance.now()-o)))))},v=()=>{let e=document.querySelector(".heroslider .video-poster-overlay, .heroslider img[fetchpriority='high'], main img[fetchpriority='high']");e?e.complete?"function"==typeof e.decode?e.decode().catch(()=>{}).finally(w):w():(e.addEventListener("load",w,{once:!0}),e.addEventListener("error",w,{once:!0})):w()};s.addEventListener("animationend",e=>{e.target===s&&"global-loader-failsafe"===e.animationName&&f()}),m=()=>{l||document.hidden||(y(),v())},document.addEventListener("visibilitychange",m),y(),"loading"===document.readyState?document.addEventListener("DOMContentLoaded",v,{once:!0}):v()})();let em=function(){let e=["ar-AE","ar","ar-ww","ar-ae","he-IL"],t=null,n=function(){let n=document.documentElement.lang;e.some(function(e){return n.includes(e)})&&(window.bcl&&window.bcl.u&&"function"==typeof window.bcl.u.loadStyleSheet&&window.bcl.u.loadStyleSheet("/etc.clientlibs/barcelo/clientlibs/clientlib-rtl.css"),t&&(t.disconnect(),t=null))};n(),t||e.some(function(e){return document.documentElement.lang.includes(e)})||(t=new MutationObserver(n)).observe(document.documentElement,{attributes:!0,attributeFilter:["lang"]})},eh=function(){eu(function(){(()=>{if(!document.body||!document.querySelector(".component-loader, .dynamicLoading, .dynamicComponent"))return;let t=[],n=!1,o=()=>{n=!1;let o=t;t=[];let i=t=>{let n=Math.min(t+10,o.length);for(let e=t;e{e.closest(".dynamicComponent")||e.remove()})}ni(n))};o.length&&i(0)},i=new MutationObserver(i=>{let r=!1;for(let e of i)if("childList"===e.type&&e.addedNodes?.length){for(let n of e.addedNodes)t.push(n);r=!0}r&&(n||(n=!0,e(o)))});try{i.observe(document.body,{childList:!0,subtree:!0})}catch(e){console.error("Error observing body in deleteUnnecessaryLoaders:",e)}let r=()=>{document.querySelector(".component-loader, .dynamicLoading, .dynamicComponent")||i.disconnect()};window.addEventListener("load",()=>e(r),{once:!0}),setTimeout(r,8e3)})(),em()})};"loading"===document.readyState?document.addEventListener("DOMContentLoaded",eh,{once:!0}):eh()})(); //# sourceMappingURL=/etc.clientlibs/barcelo/clientlibs/clientlib-critical/critical.js.map